package api

import (
	"api-gateway/basic/config"
	__ "api-gateway/basic/proto"
	"api-gateway/handler/request"
	"github.com/gin-gonic/gin"
	"net/http"
)

func OnLineadd(context *gin.Context) {
	var l request.Onlinadd
	if err := context.ShouldBind(&l); err != nil {
		context.JSON(400, gin.H{
			"code": 400,
			"msg":  "验证失败",
			"data": err.Error(),
		})
		return

	}
	_, err := config.AppointmentClient.OnlineAdd(config.Ctx, &__.OnlineAddReq{
		ConsultId:    l.ConsultId,
		UserId:       l.UserId,
		DoctorId:     l.DoctorId,
		DepartmentId: l.DepartmentId,
		Ontype:       l.Ontype,
		MainComplain: l.MainComplain,
		//SymptomDesc:  l.SymptomDesc,
		IsUrgent: l.IsUrgent,
		Status:   l.Status,
	})
	if err != nil {
		context.JSON(400, gin.H{
			"code": 400,
			"msg":  "账号禁用",
			"data": err.Error(),
		})
		return
	}
	context.JSON(http.StatusOK, gin.H{
		"code": 200,
		"msg":  "添加成功",
	})
}
